Command Reference


This chapter describes the Internet Connection Server commands:

  • cgiparse Command
  • cgiutils Command
  • htadm Command
  • htimage Command
  • http Daemon

    cgiparse Command

    The cgiparse command handles QUERY_STRING environment variable parsing for CGI scripts. If the QUERY_STRING environment variable is not set, it reads CONTENT_LENGTH characters from its standard input.


    Syntax

    cgiparse -Flag [Modifier]

    Flags

    Main Flags

    All options have one-character equivalents: -k -f -v -r -i

    -keywords
    Parse QUERY_STRING as search keywords. Keywords are decoded and written to standard output, one per line.
    -form
    Parse QUERY_STRING as form request. Outputs a string which will set variables beginning with FORM_ appended with field name. Field values are the contents of the variables.
    -value
    Parse QUERY_STRING as form request. Prints only the value of field FieldName.
    -read
    Read CONTENT_LENGTH characters from stdin and write them to stdout.
    -init
    If you do not define QUERY_STRING, read stdin and output a string that will set QUERY_STRING to its correct value. This can be used when the same script is used with both GET and POST method. A typical use is: eval 'cgiparse -init'. After this command the QUERY_STRING environment variable will be set regardless of whether GET or POST method was used. Therefore cgiparse may be called multiple times in the same script. Otherwise with POST it could only be called once because after that the stdin would be already read, and the next cgiparse would hang.

    Modifier Flags

    Flags have one-character equivalents: -s -p -c -n -q

    -sep separator
    Specify the string used to separate multiple values. Values are:
    -value
    Default is newline
    -form
    Default is ", "
    -prefix prefix
    Only with -form. Specify the prefix to use when making up environment variable names. Default is "FORM_".
    -count
    Values are:
    -keywords
    Outputs the number of keywords
    -form
    Outputs the number of unique fields (multiple values are counted as one)
    -value
    Field_Name gives the number of values of field Field_Name (no such field is zero, one field gives1, one multiple 2, etc.)
    -number
    For example -2. Values are:
    -keywords
    Gives n'th keyword
    -form
    Gives all the values of n'th field
    -value
    Field_Name gives n'th of the multiple values of field Field_Name (first value is number 1)
    -quiet
    Suppress all error messages. (Non-zero exit status still indicates error.)

    Exit Statuses

    0
    Success
    1
    Illegal command line
    2
    Environment variables not set correctly
    3
    Failed to get requested information (no such field, QUERY_STRING contains keywords when form field values requested, etc).

    cgiutils Command

    Use the cgiutils command to produce a full HTTP1 response header by no-parse header scripts.


    Syntax

    cgiutils -Flag [Modifier]

    Flags

    -version
    Print version information.
    -nodate
    Do not produce the Date: header.
    -noel
    Do not print a blank line after headers. This is useful if you want to output other MIME headers after the initial header lines.
    -status nnn
    Give full HTTP1 response with status code nnn, instead of only a set of HTTP headers. Do not use this flag if you want to produce only the expires field.
    -reason explanation
    Specify the reason line for HTTP1 response. You can only use this flag with the -status nnn flag.
    -ct Type/Subtype
    Specify MIME content type.
    -ce Encoding
    Specify content-encoding (for example, x-compress).
    -dl Language-Code
    Specify content-language code.
    -length nnn
    Specify MIME content-length value.
    -expires Time-Spec
    Specify the time to live. For example, if you specify 2 days 12 hours, the cgiutils command will compute the Expires: field value, which is the actual expiration date and time in GMT and in format specified by the HTTP specification.
    -expires Now
    Expire immediately.
    -uri URI
    Specify the URI for the returned document.
    -extra xxx:yyy
    Specify an extra header that cannot otherwise be specified for cgiutils.

    Examples

    htadm Command

    Use the htadm command to create, change, or delete server password files. If you do not specify the password or user name, the server will prompt you for this information. You must always specify the name of the password file.

    You should not specify passwords to be longer than 8 characters. Because htadm destroys the password from the command line as soon as possible, it is highly unlikely that you can see a user's password by looking at the process listing on the machine (with the ps command, for example).


    Syntax

    htadm -Flag [Modifier]

    Flags

    -adduser [PasswordFile UserName [Password [RealName]]]
    Adds a user and password into the password file. This command will fail if there is already a user of the name in the file.
    -deluser PasswordFile [UserName]
    Deletes a user from the password file. This command fails if there is no user by that name in the file.
    -passwd PasswordFile [UserName [Password]]
    Changes user's password. This command fails if there is no user by that name in the file.
    -check PasswordFile [UserName [Password]]
    Checks user's password. This command will fail if there is no user by that name in the file. The server will write either Correct or Incorrect to standard output. It will also give a 0 return value if the password was correct.
    -create PasswordFile
    Creates an empty password file.

    Examples

    htimage Command

    You can use the htimage command to create a clickable image mapping based upon the user's image file. You must already have the map file before you can use this command. The htimage command is located in the /cgi-bin/ directory of the server root. It is a CGI script that will execute based upon the regions clicked within an image file. The map file is a text file containing URL's and region mappings in pixels.

    Currently the universal image file accepted by all browsers and servers is the GIF format. GIF is an 8-bit 256 color image file.

    You must use the htimage command from within a Web document using the URL line PUT method. (You can not use this command from the command line.)


    Syntax

    htimage [Mapfile]

    Examples

    http Daemon

    Use the http daemon to start the Internet Connection Server. The file name of the command is /etc/httpd.

    You can use the Directory argument, to indicate the directory to be exported. If not present, a rule file can be used to export combinations of directories. The default setting is to export the /Public directory tree.

    You can set all these flags (except -r) using the directives in the server configuration file. You can set the directory-browsing flags with the DirAccess configuration directive. It is common practice to create a file named README containing instructions or notices to be read by anyone new to the directory. httpd will by default imbed any README file in the hypertext version of a directory. The README file instructions can also be set with the DirReadme configuration directive.


    Syntax

    httpd [-Option -Option -Option ...] [Directory]

    Flags

    -r RuleFile
    Use this file as the configuration file. You should use this flag if you do not have the default configuration file, /etc/httpd.conf.
    -p PortNumber
    Listen to this port number.
    -l LogFile
    Use this file to log requests.
    -gc_only
    Do only garbage collection and then exit. This flag is used only for proxy servers.
    -v
    Verbose. Turns on debugging messages. This flag is for debugging purposes only. Do not use it unless instructed to do so by IBM support personnel.
    -vv
    Very Verbose. Turn on the maximum number of verbose debugging messages. This flag is for debugging purposes only. Do not use it unless instructed to do so by IBM support personnel.
    -version
    Print the version number of httpd and libwww (the WWW Common Library).
    -dy
    Enable directory browsing. Directories are returned as hypertext documents. This is the default setting. You can combine -dy with the -db and -dt options (for example, -dyb, -dty).
    -dn
    Disable directory browsing. An attempt to access a directory will generate an error response.
    -ds
    Selective directory browsing. Enabled only for directories containing a file named .www_browsable.
    -dt
    For any browsable directory that contains a README file, include the text of the README file at the top of the document before the listing. This is the default setting. You can combine -dt with the -dy and -db options (for example, -dty, -dtb).
    -db
    Same as the -dt flag but puts the README at the bottom, after the listing. You can combine -db with the -dy and -dt options (for example, -dyb, -dtb).
    -dr
    Disables the README inclusion feature.

    Signal

    SIGHUP
    Restart an already running httpd. This causes httpd to reload its configuration files and reopen its log files.

    Examples


    Documentation| Help Index |  Glossary